package tspda

import glory.xxd.Utils
import tsCIM.ResultCode
import tsCIM.modelForInterface.Header
import tsCIM.modelForInterface.RequestModel
import tsCIM.modelForInterface.ResultModel
import tsCIM.modelForInterface.Return

class PDALotOutRequestController {


    def commentService

    def index() {
        def result = ResultModel.getResultModel()
        try {
            def EQPID = params?.EQPID
            def USERNAME = params?.USERNAME
            def MACHINENAME = params.MACHINENAME ?: ""
            def body = [USERNAME: USERNAME, EQPID: EQPID]
            Header header = new Header(TRANSACTIONID: Utils.getUUID(), MESSAGENAME: "PDALotOutRequest", MACHINENAME: MACHINENAME)
            Return aReturn = new Return()
            RequestModel requestModel = new RequestModel(header: header, body: body, aReturn: aReturn)
//            result = commentService.getJsonByTopic2Queue(requestModel,"sendmqname","returnmqname",true,responseXml)
            result = commentService.getJsonByTopic2Queue(requestModel, "jms.topic.PDA.TO.CIM", "jms.queue.CIM.PDA.Send", false, false)
        } catch (Exception e) {
            result.put(ResultModel.ServerErrorFlag, true)
            result.put(ResultModel.Code, ResultCode.SERVER_INTERFACE_ERROR.code)
            result.put(ResultModel.Msg, ResultCode.SERVER_INTERFACE_ERROR.msg)
            result.put(ResultModel.Data, e.getMessage())
            e.printStackTrace()
        } finally {
            render Utils.getFormatString(result)
        }
    }

    def responseXml = """
<MESSAGE>
<HEADER>
  <TRANSACTIONID>771e82c8-49df-455d-9cec-81b1d6414f1b</TRANSACTIONID>
  <MESSAGENAME>PDALotOutResponse</MESSAGENAME>
  <MACHINENAME>WM-2112</MACHINENAME>
  <WORKNO>1</WORKNO>
  <EVENTUSER>CIM</EVENTUSER>
  <EVENTTIME>2019-03-17 00:04:44.021</EVENTTIME>
</HEADER>
<BODY>
  <MAINALARMLIST>
    <MAINALARM>
      <ALARMINFO>NSOP</ALARMINFO>
      <ALARMCOUNT>100</ALARMCOUNT>
    </MAINALARM>
    <MAINALARM>
      <ALARMINFO>NSOL</ALARMINFO>
      <ALARMCOUNT>100</ALARMCOUNT>
    </MAINALARM>
  </MAINALARMLIST>
  <MATERIALPROPLIST>
    <MATERIALPROP>
      <MATERIALTYPE>MoldingCompound</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <MATERIALSIZE>值</MATERIALSIZE>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>InjectionHeadAndBarrel</MATERIALTYPE>
      <MACHINED_DIE_NUMBER>值</MACHINED_DIE_NUMBER>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Punch</MATERIALTYPE>
      <MACHINED_DIE_NUMBER>值</MACHINED_DIE_NUMBER>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>WeldingWire</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <MATERIALSIZE>值</MATERIALSIZE>
      <SUPPLIER>值</SUPPLIER>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Cleaver</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <MATERIALSIZE>值</MATERIALSIZE>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Fixture</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Epoxy</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <THAWING_END_TIME>value</THAWING_END_TIME>
      <THAWING_START_TIME>value</THAWING_START_TIME>
      <EXPIRATION_TIME>值</EXPIRATION_TIME>
      <BATCH_NO>value</BATCH_NO>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>LF</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <MATERIALSIZE>值</MATERIALSIZE>
      <BATCH_NO>value</BATCH_NO>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>SuctionNozzle</MATERIALTYPE>
      <MATERIALSIZE>值</MATERIALSIZE>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Thimble</MATERIALTYPE>
      <MATERIALSIZE>值</MATERIALSIZE>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>AdhesiveFilm</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <BATCH_NO>值</BATCH_NO>
      <THICKNESS>值</THICKNESS>
      <PERIOD_VALIDITY>value</PERIOD_VALIDITY>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>DicingKnifeZ1</MATERIALTYPE>
      <MATERIALMODEL>value</MATERIALMODEL>
      <THICKNESS>value</THICKNESS>
      <BLADE_NO>值</BLADE_NO>
      <BLADE_BORE>值</BLADE_BORE>
      <BLADE_OD>值</BLADE_OD>
      <EXPOSURE_DOSE>value</EXPOSURE_DOSE>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>DicingKnifeZ2</MATERIALTYPE>
      <MATERIALMODEL>value</MATERIALMODEL>
      <THICKNESS>value</THICKNESS>
      <BLADE_NO>值</BLADE_NO>
      <BLADE_BORE>值</BLADE_BORE>
      <BLADE_OD>值</BLADE_OD>
      <EXPOSURE_DOSE>value</EXPOSURE_DOSE>
      <NUMBER>xx</NUMBER>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>GrindingWheel</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <BATCH_NO>值</BATCH_NO>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>ThinnerAdhesiveFilm</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <MATERIALSIZE>值</MATERIALSIZE>
      <BATCH_NO>值</BATCH_NO>
      <THICKNESS>值</THICKNESS>
      <PERIOD_VALIDITY>value</PERIOD_VALIDITY>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Insert</MATERIALTYPE>
      <MACHINED_DIE_NUMBER>值</MACHINED_DIE_NUMBER>
    </MATERIALPROP>
  </MATERIALPROPLIST>
  <LOTID>xxxx</LOTID>
  <EQPID>DB-447</EQPID>
  <TOTALQTY>1230</TOTALQTY>
  <RECIPEID>XXXX222222</RECIPEID>
  <RECIPENO>SSSS/2222</RECIPENO>
  <WAFERSOURCE>XXXXX</WAFERSOURCE>
  <DIAGRAM>xxxxxxx</DIAGRAM>
  <TABLETS>0</TABLETS>
  <DONETABLETS>0</DONETABLETS>
  <DONEQTY>1000</DONEQTY>
  <ISPROCESSSTART>true</ISPROCESSSTART>
  <PROCESSSTARTTIME>2019-03-17T00:04:26.6546797+08:00</PROCESSSTARTTIME>
  <PROCESSENDTIME>2019-03-17T01:04:26.6546797+08:00</PROCESSENDTIME>
  <TRACKINTIME>2019-03-17T00:04:26.6546797+08:00</TRACKINTIME>
  <PROCESSSTATUS>RUN</PROCESSSTATUS>
  <OPID>IE05</OPID>
  <ISDOWNLOADRECIPE>true</ISDOWNLOADRECIPE>
  <ISCOMPAREPARAMETER>true</ISCOMPAREPARAMETER>
  <ISSTATUS>Y</ISSTATUS>
  <YIEID>0.98</YIEID>
  <UPH>111</UPH>
  <DEFECTSUM>0</DEFECTSUM>
</BODY>
<RETURN>
  <RETURNCODE>0</RETURNCODE>
  <RETURNMESSAGE>结束作业界面信息展示</RETURNMESSAGE>
</RETURN>
</MESSAGE>
   """

}